<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/header.jsp" %>
<div class="page-header">
	<h1>
		文件上传下载demo
	</h1>
</div>
<br>
<!-- <div align="center">
	<font size="4" color="white"><input type="button" value="上传文件" id="hiwanFileUpload"/><br><br>
	<input type="button" value="下载文件" id="hiwanFileDownload" onclick="view('测试文件.xls','0add5f11-ac4d-4b20-bf6b-3524ada33d84.xls')"/>
	<a href="#" onclick="view('测试文件.xls','0add5f11-ac4d-4b20-bf6b-3524ada33d84.xls')">下载文件</a>
	</font>
</div> -->
<p>
	<button class="btn btn-white btn-info btn-bold" id="hiwanFileUpload">
		<i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>
		上传文件
	</button>

	<button class="btn btn-white btn-warning btn-bold" onclick="view('测试文件.xls','0add5f11-ac4d-4b20-bf6b-3524ada33d84.xls')">
		<i class="ace-icon fa fa-trash-o bigger-120 orange"></i>
		下载文件
	</button>

	<!-- <button class="btn btn-white btn-default btn-round" id="hiwanFileUpload2">
		上传图片
		<i class="ace-icon fa fa-times red2"></i>
	</button> -->
</p>
<!-- <br><br>
<div align="center">
	<font size="5" color="white"><input type="button" value="上传图片" id="hiwanFileUpload2"/></font>
</div> -->

<script type="text/javascript">

	function view(fileName,fileServerName){
		 alert("下载文件");
		 //真实下载url如下
		 //window.location = "${rc.contextPath}/file/downloadFile.do?attachFileName="+fileName+"&fileServerName="+fileServerName+"&fileType=1"+"&belongOrg=${sessionOrg}";
	}

	var scripts = [null, null];
	$('.page-content-area').ace_ajax('loadScripts', scripts, function() {	
		$("#hiwanFileUpload2").hiwanFileUpload({
		     //busiId:'picture', //作为文件的挂靠业务id 必输
		     orgId:'${fns:getOrgId()}',
		     type:"images",
		     filters:".jpg",
		     max_file_size:50,//mb
		     uploadSuccess:function(file,msg,status){
		    	 alert("图片上传完成");
		     },
		     removedFile:function(msg){
		    	 alert("图片删除");
		     }
		     
		});
		$("#hiwanFileUpload").myfileupload({
			     //busiId:'aaa', //作为文件的挂靠业务id 必输
			     orgId:'${fns:getOrgId()}',
			     type:"file",
			     max_file_size:50,//mb
			     uploadSuccess:function(file,msg,status){
			    	 alert(file.md5Name);
			    	 alert("上传完成");
			     }
			     /* ,
			      fileAdded:function(file){
			    	 alert("文件添加");
			     },
			     removedFile:function(msg){
			    	 alert("文件删除");
			     } */
			     
			});
		
	});
</script>